Msg( "Loaded HGF Client VGUI File.\n" )

hook.Add( "ForceDermaSkin", "hgf_DermaSkin", function( )
	return "hgskin_black"
end )

HG.VGUI = {
	Items = {},
	Players ={},
	Data={}
}
	
HG.VGUI._F = {}
HG.VGUI._Tabs = {}

/* =================================================
 D E R M A   C O D E   B E L O W   T H I S  L I N E
===================================================*/

/* =================================================
 V G U I   C O D E   B E L O W   T H I S   L I N E
===================================================*/

function HG.VGUI.LoadInfoTab( )

	if !HG.VGUI._F then return end
	if !HG.VGUI._F._PS then return end

	HG.VGUI._F._PS._PL = vgui.Create( "DPanelList", HG.VGUI._F._PS )
	HG.VGUI._F._PS._PL:SetWide(HG.VGUI._F._PS:GetWide())
	HG.VGUI._F._PS._PL:SetTall(HG.VGUI._F._PS:GetTall())
	HG.VGUI._F._PS._PL:EnableHorizontal(false)
	HG.VGUI._F._PS._PL:EnableVerticalScrollbar(true)
	HG.VGUI._F._PS._PL:SetSpacing(1)
	
	/*------------------------------------------------
		Info Code Here
	--------------------------------------------------*/
	local HTMLTest = vgui.Create("HTML", HG.VGUI._F._PS._PL)
	HTMLTest:SetPos(2,2)
	HTMLTest:StretchToParent( 2, 2, 2, 2 )
	HTMLTest:OpenURL("http://hellsgamers.com/messageoftheday/gmodzombie")

	HG.VGUI._F._PS:AddSheet( "Info", HG.VGUI._F._PS._PL, "gui/silkicons/page", false, false, "Purchase special items for your character here.")
	
end

local b_IsReviewerOpen = false
local function CreateItemReview( item )
	if b_IsReviewerOpen then return end
	b_IsReviewerOpen = true
	local _ItemViewF = vgui.Create("DFrame")
	_ItemViewF:SetSize(258,280)
	_ItemViewF:SetTitle(item.PrintName)
	_ItemViewF:Center(true)
	_ItemViewF:SetVisible(true)
	_ItemViewF:MakePopup(true)
	_ItemViewF.Close = function( )
		_ItemViewF:SetVisible(false)
		b_IsReviewerOpen = false
	end
		_ItemViewF.ModelPanel = vgui.Create( "DModelPanel", _ItemViewF )
		_ItemViewF.ModelPanel:SetPos(1,22)
		_ItemViewF.ModelPanel:SetModel( LocalPlayer():GetModel() )
		_ItemViewF.ModelPanel:SetSize( 256, 256 )
		_ItemViewF.ModelPanel:SetAnimated( true )
		_ItemViewF.ModelPanel:SetAnimSpeed( 1 )
		_ItemViewF.ModelPanel:SetCamPos( Vector( 64, 64, 96 ) )
		_ItemViewF.ModelPanel:SetLookAt( Vector( 0, 0, 36 ) )
		_ItemViewF.ModelPanel:SetFOV( 55 )
		function _ItemViewF.ModelPanel:LayoutEntity( )
			print(tostring(self))
			if type(self) == "table" then PrintTable(self) end
			self:RunAnimation()
		end
end
local itemiconsize = 64
local b_Equiped = b_Equiped or false
local b_CanAfford = b_CanAfford or false
local b_Owned = b_Owned or false

local function CreateItemPanel( item )

end

function HG.VGUI.LoadShopTab( )

	if !HG.VGUI._F then return end
	if !HG.VGUI._F._PS then return end

	HG.VGUI._F._PS._PL2 = vgui.Create( "DPanelList", HG.VGUI._F._PS )
	HG.VGUI._F._PS._PL2:SetWide(HG.VGUI._F._PS:GetWide())
	HG.VGUI._F._PS._PL2:SetTall(HG.VGUI._F._PS:GetTall())
	HG.VGUI._F._PS._PL2:EnableHorizontal(false)
	HG.VGUI._F._PS._PL2:EnableVerticalScrollbar(true)
	HG.VGUI._F._PS._PL2:SetSpacing(1)
	
	// Load all items from the objects table
	--for UniqueID, ITEM in pairs( HG.ITEMS ) do
	for ID, UniqueID in pairs( HG.OrganizedItems() ) do
		local ITEM = HG.Item(UniqueID)
		local priceColor = priceColor or Color(180,180,180,150)
		local s_priceText = s_priceText or ""
		local _P = vgui.Create( "DPanel", HG.VGUI._F._PS._PL2 )
		_P:SetTall(itemiconsize)
		_P:SetWide(HG.VGUI._F._PS:GetWide())
		if ITEM.Model then
			_P._SI = vgui.Create( "DModelPanel", _P )
			_P._SI:SetSize(itemiconsize,itemiconsize)
			if ITEM.Color then 
				_P._SI:SetColor(ITEM.Color)
			else
				_P._SI:SetColor(Color(255,255,255,255))
			end
			_P._SI:SetModel(ITEM.Model)
			_P._SI:SetCamPos( Vector( 16, 16, 16 ) )
			_P._SI:SetLookAt( Vector( 0, 0, 0 ) )
			_P._SI:SetFOV( 65 )
			_P._SI.OnCursorEntered = function( ) _P._SI.b_MouseOver = true end
			_P._SI.OnCursorExited = function( ) _P._SI.b_MouseOver = false end
			_P._SI.PaintOver = function( )
				local w, h = _P._SI:GetWide(), _P._SI:GetTall()
				local colIcon = Color(0,0,0,50)
				if _P._SI.b_MouseOver then colIcon = Color(150,150,150,50) end
				draw.RoundedBox(6,0,0,w,h,colIcon)
			end
			_P._SI.DoClick = function( )
				CreateItemReview( ITEM )
			end
			/*
			_P._SI = vgui.Create( "SpawnIcon", _P )
			_P._SI:SetIconSize(itemiconsize)
			_P._SI:SetModel(ITEM.Model)
			_P._SI.DoClick = function( )
				CreateItemReview( ITEM )
			end
			*/
		elseif !ITEM.Model and ITEM.TrailTexture then
			_P._SI = vgui.Create( "DImageButton", _P )
			_P._SI:SetImage( ITEM.TrailTexture )
			_P._SI:SetColor( ITEM.Color )
			_P._SI:SetSize( itemiconsize,itemiconsize )
			_P._SI.OnCursorEntered = function( ) _P._SI.b_MouseOver = true end
			_P._SI.OnCursorExited = function( ) _P._SI.b_MouseOver = false end
			_P._SI.PaintOver = function( )
				local w, h = _P._SI:GetWide(), _P._SI:GetTall()
				local colIcon = Color(0,0,0,50)
				if _P._SI.b_MouseOver then colIcon = Color(150,150,150,50) end
				draw.RoundedBox(6,0,0,w,h,colIcon)
			end
			_P._SI.DoClick = function( )
				CreateItemReview( ITEM )
			end
		end
		_P.Paint = function( )
			if not HG.CLIENT.money then HG.CLIENT.money = 0 end
			
			b_Owned = table.HasValue(HG.CLIENT.inv,ITEM.UniqueID)
			b_CanAfford = HG.CLIENT.money >= ITEM.BuyPrice
			b_Equiped = GetConVar("hg_hat")==ITEM.UniqueID or GetConVar("hg_trail")==ITEM.UniqueID or GetConVar("hg_aura")==ITEM.UniqueID
			
			if b_Owned then
				s_priceText = "SOLD"
			else
				s_priceText = "$ "..tostring(ITEM.BuyPrice)
			end
			if b_CanAfford then
				priceColor = Color(20,100,20,200)
			else
				priceColor = Color(100,20,20,200)
			end
			local border = 1
			local w, h = _P:GetWide(), _P:GetTall()
			local color = Color(255,255,255,25)
			if b_Equiped then
				draw.RoundedBox(0,0,0,w,h,Color(255,255,255,15))
				draw.SimpleTextOutlined("EQUIPED", "TargetID", w-w/3, h/2-4, Color(20,200,20,255), 1, 1, 1, Color(200,255,200,100))
			end
			draw.RoundedBox(6, 0, 0, w, h, Color(0,0,0,100))
			draw.RoundedBox(6, border, border, w-(border*2), h-(border*2), Color(50,0,0,100))
			if _P.b_MouseOver then
				for i = 1, h do
					draw.RoundedBox(0,0,0+i,w,3,Color(color.r/32,color.g/32,color.b/32,(color.a)*(i/h)))
				end
				if b_CanAfford and not b_Owned then
					draw.SimpleTextOutlined("BUY NOW!", "HUDHintTextLarge", w/2, h/2, Color(90,0,0,255), 1, 1, 1, Color(150,0,0,75))
				end
			end
			--draw.DrawText(tostring(UniqueID), "DefaultBold", 32+w/16, h/2, Color(255,255,255,255),1 )
			draw.DrawText(tostring("[#"..ITEM.ID.."] " ..ITEM.PrintName), "TargetID", w/12 + 2, h/8, Color(255,255,255,255),0 )
			draw.DrawText(tostring(ITEM.Description), "DefaultSmall", w/12 + 6, h/2, Color(255,200,200,150),0 )
			draw.SimpleTextOutlined(tostring(s_priceText), "Trebuchet24", w-w/12, h/2, Color(200,200,200,200), 1, 1, 1, priceColor )
		end
		_P.OnCursorEntered = function( )
			_P.b_MouseOver = true
		end
		_P.OnCursorExited = function( )
			_P.b_MouseOver = false
		end
		_P.OnMousePressed = function( mousecode )
			local _dM = DermaMenu( )
			if table.HasValue(HG.CLIENT.inv,ITEM.UniqueID) then 
				_dM:AddOption("EQUIP/UNEQUIP",function() 
					b_Equiped = true 
					RunConsoleCommand("hg_"..string.lower(HG.SLOTS[ITEM.Slot].name), ITEM.UniqueID)
				end )
			else
				_dM:AddOption("BUY",function()
					if HG.CLIENT.money >= ITEM.BuyPrice then
						Derma_Query( "Are you sure you want to purchase this item?", "WARNING", 
							"YES", function() RunConsoleCommand("hg_item_cmd", "buy", ITEM.UniqueID) end, 
							"NO", function() return false end )
					else
						Derma_Message( "You cannot afford this item", "ERROR", "OK" )
					end
				end)
			end
			_dM:Open()
		end
		
		HG.VGUI._F._PS._PL2:AddItem( _P )
	end
	
	HG.VGUI._F._PS:AddSheet( "Shop", HG.VGUI._F._PS._PL2, "gui/silkicons/box", false, false, "Purchase special items for your character here.")

end

function HG.VGUI.LoadServersTab( )
	
	if !HG.VGUI._F then return end
	if !HG.VGUI._F._PS then return end

	HG.VGUI._F._PS._PL3 = vgui.Create( "DPanelList", HG.VGUI._F._PS )
	HG.VGUI._F._PS._PL3:SetWide(HG.VGUI._F._PS:GetWide())
	HG.VGUI._F._PS._PL3:SetTall(HG.VGUI._F._PS:GetTall())
	HG.VGUI._F._PS._PL3:EnableHorizontal(false)
	HG.VGUI._F._PS._PL3:EnableVerticalScrollbar(true)
	HG.VGUI._F._PS._PL3:SetSpacing(1)

	/*------------------------------------------------
		Servers Code Here
	-------------------------------------------------*/
	
	for k, server in ipairs( HG.Servers ) do
		
		local panel_server = vgui.Create( "DPanel", HG.VGUI._F._PS._PL3 )
		panel_server:SetWide( 350 )
		panel_server:SetTall( 20 )
		
		local serverbanner = vgui.Create("HTML", panel_server)
		//serverbanner_1:SetPos(2,2)
		--serverbanner_1:StretchToParent( 2, 2, 2, 2 )
		serverbanner:SetSize(350,20)
		serverbanner:OpenURL( server.gif_url )

		local button_join = vgui.Create( "DButton", panel_server )
		button_join:MoveRightOf( serverbanner )
		button_join:SetText("")
		button_join:SetTall(20)
		button_join:SetWide(256)
		button_join.DoClick = function( )
			print( "Redirecting player to: "..server.ip.. " - " ..server.name )
			RunConsoleCommand( "connect", server.ip )
		end
		button_join.Paint = function( )
			local i_Border, w, h = 1, button_join:GetWide(),button_join:GetTall()
			draw.RoundedBox( 6, 0, 0, w, h, Color( 90,90,90,175) )
			draw.RoundedBox( 6, i_Border, i_Border, w-i_Border*2, h-i_Border*2, Color( 175,0,0,150) )
			draw.DrawText( "CLICK TO JOIN:" , "BudgetLabel", w*(1/3),h/6, Color( 200,0,0,175), 1 )
			draw.DrawText( server.name, "UiBold", w*(2/3),h/6, Color( 200,200,200,175), 1 )
		end
		
		HG.VGUI._F._PS._PL3:AddItem( panel_server )
		
	end
		
	HG.VGUI._F._PS:AddSheet( "Servers", HG.VGUI._F._PS._PL3, "gui/silkicons/world", false, false, "All of our other Gmod servers")

end

function HG.VGUI.LoadScoreboardTab( )

	if !HG.VGUI._F then return end
	if !HG.VGUI._F._PS then return end

	HG.VGUI._F._PS._PL4 = vgui.Create( "DPanelList", HG.VGUI._F._PS )
	HG.VGUI._F._PS._PL4:SetWide(HG.VGUI._F._PS:GetWide())
	HG.VGUI._F._PS._PL4:SetTall(HG.VGUI._F._PS:GetTall()-32)
	HG.VGUI._F._PS._PL4:EnableHorizontal(false)
	HG.VGUI._F._PS._PL4:EnableVerticalScrollbar(true)
	HG.VGUI._F._PS._PL4:SetSpacing(1)
	
	do
		
		for k, v in pairs( player.GetAll() ) do

			if !v or !IsValid(v) then return; end
		
			local Panel_Player = vgui.Create( "DPanel", HG.VGUI._F._PS._PL4 )
			Panel_Player:StretchToParent(2,2,2,2);
			Panel_Player:SetHeight(34)
			
			local Avatar1 = vgui.Create("AvatarImage", Panel_Player)
			Avatar1:SetPos(1,1)
			Avatar1:SetSize(32, 32)
			Avatar1:SetPlayer( v )
			Avatar1.DoClick = function( )
				local menu = DermaMenu()
				menu:AddOption("Add Friend",function() print("Friend request has been sent to: "..tostring(v:Nick())) end)
				menu:Open()
			end
		
			local i_Red = i_Red or 50
			-- local i_HGStatus = Get Player's Rank from HG Servers
			local Button_Info = vgui.Create("DButton", Panel_Player)
			Button_Info:SetText("")
			Button_Info:MoveRightOf(Avatar1)
			Button_Info:SetWidth(Panel_Player:GetWide()-Avatar1:GetWide())
			Button_Info:SetHeight(Panel_Player:GetTall()*0.96)
			--Button_Info:SizeToContents();
			Button_Info.PaintOver = function( )
				local w, h = Button_Info:GetSize( )
				local s_Nick = v:Nick()
				local c_NickColor = Color(200,200,200,255)
				draw.DrawText(tostring(v:Nick()), "HudSelectionText", 4,h/2,c_NickColor,0)
				draw.DrawText(tostring(v:SteamID()), "UiBold", w/4,h/2,Color(255,255,255,200),0)
				draw.DrawText(tostring("0.0.0.0"), "UiBold", w/2,h/2,Color(255,255,255,200),0)
				draw.DrawText(tostring(v:Ping()).." ms", "UiBold", w*(3/4),h/2,Color(255,255,255,200),0)
				--draw.SimpleTextOutlined( "$"..tostring(v:GetNetworkedInt("var.1")), "UiBold", w/4,h/2, Color(205,205,25,225), 0, 0, 1, Color(255,255,100,50) )
				--draw.DrawText(tostring(v:GetNetworkedInt("stat.1")), "UiBold", w/3,h/2,Color(255,255,255,200),0)
				--draw.DrawText(tostring(v:GetNetworkedInt("stat.2")), "UiBold", w*(2/3),h/2,Color(255,255,255,200),0)
			end
			Button_Info.Paint = function( )
				-- different colors for different i_HGStatus's
				local w, h = Button_Info:GetSize( )
				local i_Border = 2
				draw.RoundedBox( 6, 0, 0, w, h, Color(50,0,0,75) )
				--draw.RoundedBox( 6, i_Border, i_Border, w-i_Border*2, h-i_Border*2, Color(0,0,0,150) )
				return
			end
			HG.VGUI._F._PS._PL4:AddItem( Panel_Player )
			
		end
		
	end
	
	HG.VGUI._F._PS:AddSheet( "Scoreboard", HG.VGUI._F._PS._PL4, "gui/silkicons/group", false, false, "All players currently on the server.")

end


function HG.VGUI.LoadPlayerTab( )

	if !HG.VGUI._F then return end
	if !HG.VGUI._F._PS then return end
	
	HG.VGUI._F._PS._PL5 = vgui.Create( "DPanelList", HG.VGUI._F._PS )
	HG.VGUI._F._PS._PL5:SetWide(HG.VGUI._F._PS:GetWide()-256)
	HG.VGUI._F._PS._PL5:SetTall(HG.VGUI._F._PS:GetTall())
	HG.VGUI._F._PS._PL5:EnableHorizontal(false)
	HG.VGUI._F._PS._PL5:EnableVerticalScrollbar(true)
	HG.VGUI._F._PS._PL5:SetSpacing(2)
	
		HG.VGUI._F._PS._PL5.Panel_Client = vgui.Create( "DPanel", HG.VGUI._F._PS._PL5 )
		HG.VGUI._F._PS._PL5.Panel_Client:MoveRightOf(HG.VGUI._F._PS._PL5)
		HG.VGUI._F._PS._PL5.Panel_Client:SetSize(256,256)
		
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel = vgui.Create( "DModelPanel", HG.VGUI._F._PS._PL5.Panel_Client )
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:SetPos(0,0)
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:SetModel( LocalPlayer():GetModel() )
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:SetSize( 256, 256 )
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:SetAnimated( true )
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:SetAnimSpeed( 1 )
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:SetCamPos( Vector( 64, 64, 96 ) )
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:SetLookAt( Vector( 0, 0, 36 ) )
			HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:SetFOV( 55 )

	for k, v in pairs( HG.CLIENT.inv ) do
	
		local item = HG.Item(k) or false
	
		local Panel_Data = vgui.Create( "DPanel", HG.VGUI._F._PS._PL5 )
		Panel_Data:StretchToParent(2,2,2,2);
		Panel_Data:SetHeight(16)
		
		local i_Red = i_Red or 50
		-- local i_HGStatus = Get Player's Rank from HG Servers
		local Button_Info = vgui.Create("DButton", Panel_Data)
		Button_Info:SetText("")
		Button_Info:SetPos(0,0)
		Button_Info:SetWidth(Panel_Data:GetWide()-HG.VGUI._F._PS._PL5.Panel_Client.ModelPanel:GetWide())
		Button_Info:SetHeight(Panel_Data:GetTall()*0.96)
		--Button_Info:SizeToContents();
		Button_Info.PaintOver = function( )
			local w, h = Button_Info:GetSize()
			local s_Nick = tostring(k)
			if item then
				s_Nick = item.PrintName
			end
			local c_NickColor = Color(200,200,200,255)
			draw.DrawText(s_Nick, "HudSelectionText", w/16,h/4,c_NickColor,0)
			draw.DrawText(tostring(v), "UiBold", w/16,h/4,Color(255,255,255,200),0)
			--draw.SimpleTextOutlined( "$"..tostring(v:GetNetworkedInt("var.1")), "UiBold", w/4,h/2, Color(205,205,25,225), 0, 0, 1, Color(255,255,100,50) )
			--draw.DrawText(tostring(v:GetNetworkedInt("stat.1")), "UiBold", w/3,h/2,Color(255,255,255,200),0)
			--draw.DrawText(tostring(v:GetNetworkedInt("stat.2")), "UiBold", w*(2/3),h/2,Color(255,255,255,200),0)
		end
		Button_Info.Paint = function( )
			-- different colors for different i_HGStatus's
			local w, h = Button_Info:GetSize( )
			local i_Border = 2
			draw.RoundedBox( 6, 0, 0, w, h, Color(50,0,0,75) )
			draw.RoundedBox( 6, i_Border, i_Border, w-i_Border*2, h-i_Border*2, Color(0,0,0,150) )
			return
		end
		HG.VGUI._F._PS._PL5:AddItem( Panel_Data )
		
	end
		
	HG.VGUI._F._PS:AddSheet( "Player", HG.VGUI._F._PS._PL5, "gui/silkicons/user", false, false, "All players currently on the server.")

end

function HG.VGUI.LoadHelpTab( )

	if !HG.VGUI._F then return end
	if !HG.VGUI._F._PS then return end

	HG.VGUI._F._PS._PL6 = vgui.Create( "DPanelList", HG.VGUI._F._PS )
	HG.VGUI._F._PS._PL6:SetWide(HG.VGUI._F._PS:GetWide())
	HG.VGUI._F._PS._PL6:SetTall(HG.VGUI._F._PS:GetTall())
	HG.VGUI._F._PS._PL6:EnableHorizontal(false)
	HG.VGUI._F._PS._PL6:EnableVerticalScrollbar(true)
	HG.VGUI._F._PS._PL6:SetSpacing(1)
	
	/*------------------------------------------------
		Help Code Here
	--------------------------------------------------*/
	local HTMLHelp = vgui.Create("HTML", HG.VGUI._F._PS._PL6)
	HTMLHelp:SetPos(2,2)
	HTMLHelp:StretchToParent( 2, 2, 2, 2 )
	HTMLHelp:OpenURL("http://hgdev.webs.com/index.htm")
	
	HG.VGUI._F._PS:AddSheet( "Help", HG.VGUI._F._PS._PL6, "gui/silkicons/table_edit", false, false, "Ask us a question, send in a suggestion, or report a bug.")

end

local b_IsReportOpen = false
local function GenerateReport( type )
	if b_IsReportOpen then return end
	b_IsReportOpen = true
	local _ReportF = vgui.Create("DFrame")
	_ReportF:SetSize(SCRW/2,SCRH/2)
	_ReportF:SetTitle(type.." Report Generator")
	_ReportF:Center(true)
	_ReportF:SetVisible(true)
	_ReportF:ShowCloseButton(true)
	_ReportF:MakePopup(true)
	_ReportF.Close = function( )
		_ReportF:SetVisible(false)
		b_IsReportOpen = false
	end
		_ReportF.HTML = vgui.Create( "HTML", _ReportF )
		_ReportF.HTML:SetPos(2,2)
		_ReportF.HTML:StretchToParent( 2, 22, 2, 2 )
		_ReportF.HTML:OpenURL("http://hgdev.webs.com/reports/"..type.."ReportTemp.html")
		
end

local b_Refresh = b_Refresh or false
local _LastTab = _LastTab or 0
function HG.VGUI.MainMenu( ply, cmd, arg )

	HG.VGUI._F = vgui.Create( "DFrame" )
	HG.VGUI._F:SetSize(SCRW/2,SCRH/2)
	HG.VGUI._F:Center()
	HG.VGUI._F:SetTitle([[HellsGamers' Garry's Mod-Framework Menu]])
	HG.VGUI._F:ShowCloseButton(true)
	HG.VGUI._F:MakePopup(true)
	
		HG.VGUI._F._L = vgui.Create( "DPanel", HG.VGUI._F )
		HG.VGUI._F._L:SetPos(1,26)
		HG.VGUI._F._L:SetWide(HG.VGUI._F:GetWide()-2)
		HG.VGUI._F._L:SetTall(22)
		HG.VGUI._F._L.Paint = function( )
			local w, h = HG.VGUI._F._L:GetWide(), HG.VGUI._F._L:GetTall()
			draw.RoundedBox(6,0,0,w,h,Color(0,0,0,75))
			draw.DrawText(GetConVar("hg_vgui_noticemsg"):GetString(),"UiBold",w/2,h/2,Color(200,200,200,200),1)
		end
		
		HG.VGUI._F._PS = vgui.Create( "DPropertySheet", HG.VGUI._F )	
		HG.VGUI._F._PS:MoveBelow(HG.VGUI._F._L)
		HG.VGUI._F._PS:StretchToParent(1,26+HG.VGUI._F._L:GetTall(),1,26)
		HG.VGUI._F._PS.Init = function()
			b_Refresh = true
		end
					
			HG.VGUI.LoadInfoTab( )
			HG.VGUI.LoadShopTab( )
			HG.VGUI.LoadServersTab( )
			HG.VGUI.LoadScoreboardTab( )
			HG.VGUI.LoadPlayerTab( )
			HG.VGUI.LoadHelpTab( )
			
		HG.VGUI._F._L2 = vgui.Create( "DPanel", HG.VGUI._F )
		HG.VGUI._F._L2:MoveBelow(HG.VGUI._F._PS)
		HG.VGUI._F._L2:SetWide(HG.VGUI._F:GetWide()-2)
		HG.VGUI._F._L2:SetTall(22)
		HG.VGUI._F._L2.Paint = function( )
			local w, h = HG.VGUI._F._L:GetWide(), HG.VGUI._F._L:GetTall()
			draw.RoundedBox(6,0,0,w,h,Color(0,0,0,75))
		end
			// Refresh the current page
			HG.VGUI._F._L2._B = vgui.Create( "DButton",HG.VGUI._F._L2)
			HG.VGUI._F._L2._B:SetPos(0,0)
			HG.VGUI._F._L2._B:SetSize(HG.VGUI._F._L2:GetWide()/6,HG.VGUI._F._L2:GetTall())
			HG.VGUI._F._L2._B:SetText("Refresh")
			HG.VGUI._F._L2._B.DoClick = function(btn)
				local tab = HG.VGUI._F._PS:GetActiveTab() or "?"
				print( "Refreshing Current Tab: "..tostring(tab))
				tab:PerformLayout()
			end
			// Open report page
			HG.VGUI._F._L2._B2 = vgui.Create( "DButton",HG.VGUI._F._L2)
			HG.VGUI._F._L2._B2:SetPos(nil,0)
			HG.VGUI._F._L2._B2:MoveRightOf(HG.VGUI._F._L2._B)
			HG.VGUI._F._L2._B2:SetSize(HG.VGUI._F._L2:GetWide()/6,HG.VGUI._F._L2:GetTall())
			HG.VGUI._F._L2._B2:SetText("Generate Report")
			HG.VGUI._F._L2._B2.DoClick = function(btn)
				local _dM = DermaMenu( )
				_dM:AddOption("Abuse",function() GenerateReport( "Abuse" ) end )
				_dM:AddOption("Ban",function() GenerateReport( "Ban" ) end )
				_dM:AddOption("Unban",function() GenerateReport( "Unban" ) end )
				_dM:Open()
			end

end
concommand.Add( "hg_menu2", HG.VGUI.MainMenu )

function HG.EDITOR.GetItemVar( itemid, var )
	return HG.ITEMS[itemid][var]
end

function HG.EDITOR.SetItemVar( itemid, var, val )
	HG.ITEMS[itemid][var] = val
end


function HG.VGUI.DebugMenu( )

-- Lua generated by DermaDesigner
_F2 = vgui.Create('DFrame')
_F2:SetSize(ScrW() * 0.5, ScrH() * 0.5)
_F2:Center()
_F2:SetTitle('HG-Framework: Developer Menu')
_F2:SetSizable(true)
_F2:SetDeleteOnClose(false)
_F2:MakePopup()

local _B9
local _B8
local _B7
local _B6
local _B5
local _B4
local _MC5
local _L12
local _B2
local _NW12
local _L11
local _NW11
local _NW10
local _L10
local _NS1
local _L9
local _B1
local _TE1
local _L8
local _L7
local _L6
local _L5
local _NW9
local _NW8
local _NW7
local _NW6
local _NW5
local _NW4
local _NW3
local _NW2
local _Lp
local _NW1
local _L3
local _L2
local _MC2
local _L
local _MC

_B9 = vgui.Create('DButton',_F2)
_B9:SetSize(19, 25)
_B9:SetPos(573, 406)
_B9:SetText('?')
_B9.DoClick = function() end

_B8 = vgui.Create('DButton',_F2)
_B8:SetSize(70, 25)
_B8:SetPos(501, 406)
_B8:SetText('View')
_B8.DoClick = function() end

_B7 = vgui.Create('DButton',_F2)
_B7:SetSize(70, 25)
_B7:SetPos(428, 406)
_B7:SetText('Load')
_B7.DoClick = function() end

_B6 = vgui.Create('DButton',_F2)
_B6:SetSize(70, 25)
_B6:SetPos(356, 406)
_B6:SetText('Reset')
_B6.DoClick = function() end

_B5 = vgui.Create('DButton',_F2)
_B5:SetSize(70, 25)
_B5:SetPos(284, 406)
_B5:SetText('Save')
_B5.DoClick = function() end

_B4 = vgui.Create('DButton',_F2)
_B4:SetSize(70, 25)
_B4:SetPos(211, 406)
_B4:SetText('Update')
_B4.DoClick = function() end

_MC5 = vgui.Create('DMultiChoice',_F2)
_MC5:SetPos(408, 384)
_MC5.OnMousePressed = function() end
function _MC5:OnSelect(Index, Value, Data) end

_L12 = vgui.Create('DLabel',_F2)
_L12:SetPos(209, 384)
_L12:SetText('What PlayerModel is this for?')
_L12:SizeToContents()
_L12:SetTextColor(Color(175, 238, 238, 255))
_B2 = vgui.Create('DButton',_F2)
_B2:SetSize(70, 60)
_B2:SetPos(519, 315)
_B2:SetText('Refresh')
_B2.DoClick = function() end

_NW12 = vgui.Create('DNumberWang',_F2)
_NW12:SetPos(463, 355)
_NW12:SetDecimals(0)
_NW12:SetFloatValue(0)
_NW12:SetFraction(0)
_NW12.OnMouseReleased = function() end
_NW12.OnValueChanged = function() end
_NW12:SetValue('0')
_NW12:SetMinMax( 0, 0)

_L11 = vgui.Create('DLabel',_F2)
_L11:SetPos(460, 340)
_L11:SetText('Rand (Max)')
_L11:SizeToContents()

_NW11 = vgui.Create('DNumberWang',_F2)
_NW11:SetPos(405, 355)
_NW11:SetDecimals(0)
_NW11:SetFloatValue(0)
_NW11:SetFraction(0)
_NW11.OnMouseReleased = function() end
_NW11.OnValueChanged = function() end
_NW11:SetValue('0')
_NW11:SetMinMax( 0, 0)

_NW10 = vgui.Create('DNumberWang',_F2)
_NW10:SetPos(415, 316)
_NW10:SetDecimals(0)
_NW10:SetFloatValue(0)
_NW10:SetFraction(0)
_NW10.OnMouseReleased = function() end
_NW10.OnValueChanged = function() end
_NW10:SetValue('0')
_NW10:SetMinMax( 0, 0)

_L10 = vgui.Create('DLabel',_F2)
_L10:SetPos(405, 339)
_L10:SetText('Rand (Min)')
_L10:SizeToContents()

_NS1 = vgui.Create('DNumSlider',_F2)
_NS1:SetSize(154, 40)
_NS1:SetPos(248, 337)
_NS1:SetDecimals(0)
_NS1:SetFloatValue(0)
_NS1:SetFraction(0)
_NS1.OnMouseReleased = function() end
_NS1.OnValueChanged = function() end
_NS1:SetText('Multiplier')
_NS1:SetValue(0)
_NS1:SetMinMax( 0, 1)

_L9 = vgui.Create('DLabel',_F2)
_L9:SetPos(368, 317)
_L9:SetText('Modifier')
_L9:SizeToContents()

_B1 = vgui.Create('DButton',_F2)
_B1:SetSize(70, 63)
_B1:SetPos(518, 238)
_B1:SetText('Refresh')
_B1.DoClick = function() end

_TE1 = vgui.Create('DTextEntry',_F2)
_TE1:SetSize(62, 15)
_TE1:SetPos(299, 315)
_TE1:SetText('$')
_TE1.OnEnter = function() end

_L8 = vgui.Create('DLabel',_F2)
_L8:SetPos(250, 316)
_L8:SetText('Current')
_L8:SizeToContents()

_L7 = vgui.Create('DLabel',_F2)
_L7:SetPos(209, 316)
_L7:SetText('Pricing')
_L7:SizeToContents()
_L7:SetTextColor(Color(0, 191, 255, 255))
_L6 = vgui.Create('DLabel',_F2)
_L6:SetPos(252, 286)
_L6:SetText('Scale')
_L6:SizeToContents()

_L5 = vgui.Create('DLabel',_F2)
_L5:SetPos(251, 263)
_L5:SetText('Angle')
_L5:SizeToContents()

_NW9 = vgui.Create('DNumberWang',_F2)
_NW9:SetPos(447, 282)
_NW9:SetDecimals(0)
_NW9:SetFloatValue(0)
_NW9:SetFraction(0)
_NW9.OnMouseReleased = function() end
_NW9.OnValueChanged = function() end
_NW9:SetValue('0')
_NW9:SetMinMax( 0, 0)

_NW8 = vgui.Create('DNumberWang',_F2)
_NW8:SetPos(374, 282)
_NW8:SetDecimals(0)
_NW8:SetFloatValue(0)
_NW8:SetFraction(0)
_NW8.OnMouseReleased = function() end
_NW8.OnValueChanged = function() end
_NW8:SetValue('0')
_NW8:SetMinMax( 0, 0)

_NW7 = vgui.Create('DNumberWang',_F2)
_NW7:SetPos(297, 282)
_NW7:SetDecimals(0)
_NW7:SetFloatValue(0)
_NW7:SetFraction(0)
_NW7.OnMouseReleased = function() end
_NW7.OnValueChanged = function() end
_NW7:SetValue('0')
_NW7:SetMinMax( 0, 0)

_NW6 = vgui.Create('DNumberWang',_F2)
_NW6:SetPos(447, 259)
_NW6:SetDecimals(0)
_NW6:SetFloatValue(0)
_NW6:SetFraction(0)
_NW6.OnMouseReleased = function() end
_NW6.OnValueChanged = function() end
_NW6:SetValue('0')
_NW6:SetMinMax( 0, 0)

_NW5 = vgui.Create('DNumberWang',_F2)
_NW5:SetPos(374, 259)
_NW5:SetDecimals(0)
_NW5:SetFloatValue(0)
_NW5:SetFraction(0)
_NW5.OnMouseReleased = function() end
_NW5.OnValueChanged = function() end
_NW5:SetValue('0')
_NW5:SetMinMax( 0, 0)

_NW4 = vgui.Create('DNumberWang',_F2)
_NW4:SetPos(297, 259)
_NW4:SetDecimals(0)
_NW4:SetFloatValue(0)
_NW4:SetFraction(0)
_NW4.OnMouseReleased = function() RunConsoleCommand("hg_"..type) end
_NW4.OnValueChanged = function() end
_NW4:SetValue('0')
_NW4:SetMinMax( 0, 0)

_NW3 = vgui.Create('DNumberWang',_F2)
_NW3:SetPos(447, 236)
_NW3:SetDecimals(0)
_NW3:SetFloatValue(0)
_NW3:SetFraction(0)
_NW3.OnMouseReleased = function() end
_NW3.OnValueChanged = function() end
_NW3:SetValue('0')
_NW3:SetMinMax( 0, 0)

_NW2 = vgui.Create('DNumberWang',_F2)
_NW2:SetPos(374, 236)
_NW2:SetDecimals(0)
_NW2:SetFloatValue(0)
_NW2:SetFraction(0)
_NW2.OnMouseReleased = function() end
_NW2.OnValueChanged = function() end
_NW2:SetValue('0')
_NW2:SetMinMax( 0, 0)

_Lp = vgui.Create('DLabel',_F2)
_Lp:SetPos(250, 239)
_Lp:SetText('Position')
_Lp:SizeToContents()

_NW1 = vgui.Create('DNumberWang',_F2)
_NW1:SetPos(297, 236)
_NW1:SetDecimals(0)
_NW1:SetFloatValue(0)
_NW1:SetFraction(0)
_NW1.OnMouseReleased = function() end
_NW1.OnValueChanged = function() end
_NW1:SetValue('0')
_NW1:SetMinMax( -32, 32)

_L3 = vgui.Create('DLabel',_F2)
_L3:SetPos(ScrW() * 0.268, ScrH() * 0.436)
_L3:SetText('Offset')
_L3:SizeToContents()
_L3:SetTextColor(Color(0, 191, 255, 255))
_L2 = vgui.Create('DLabel',_F2)
_L2:SetPos(ScrW() * 0.265, ScrH() * 0.389)
_L2:SetText('Choose which item you would like to edit')
_L2:SizeToContents()
_L2:SetTextColor(Color(175, 238, 238, 255))
_MC2 = vgui.Create('DMultiChoice',_F2)
_MC2:SetPos(434, 212)
_MC2.OnMousePressed = function() end
function _MC2:OnSelect(Index, Value, Data) end

_L = vgui.Create('DLabel',_F2)
_L:SetPos(ScrW() * 0.265, ScrH() * 0.352)
_L:SetText('Select an itemtype from the drop-down box')
_L:SizeToContents()
_L:SetTextColor(Color(0, 191, 255, 255))
_MC = vgui.Create('DMultiChoice',_F2)
_MC:SetPos(ScrW() * 0.548, ScrH() * 0.352)
_MC.OnMousePressed = function() end
function _MC:OnSelect(Index, Value, Data) end



end
concommand.Add( "hg_menu_debug", HG.VGUI.DebugMenu )